import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// //RBAC读 5202
// import axios2 from 'axios';
// axios2.defaults.baseURL = 'http://1.117.93.87:8000/rbacdu';

// //RBAC写 5249
// import axios1 from 'axios';
// axios1.defaults.baseURL = 'http://1.117.93.87:8000/rbacxie';
import axios from 'axios'



//拦截器
axios.interceptors.request.use(
    config => {
        if (localStorage.ToKen) {
            config.headers.Authorization = "Bearer " + localStorage.ToKen;
        }
        return config;
    },
    err => {
        return Promise.reject(err);
    }
)

//引入Element
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
const app = createApp(App)


// // 设置全局的域名（API基础域名）
// app.config.globalProperties.$apiBaseUrl = 'http://1.117.93.87:8000/rbacxie';

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
app.use(ElementPlus, {
    locale: zhCn,
})

app.use(createPinia())
app.use(router)

app.mount('#app')
